package com.evolution.app;

import java.awt.BorderLayout;
import java.util.Timer;

import javax.swing.JFrame;
import javax.swing.WindowConstants;

import com.evolution.control.Controller;
import com.evolution.model.World;
import com.evolution.timer.GrowFoodTask;
import com.evolution.view.WorldCanvas;

public class Application {

	public static void main(String[] args){
		JFrame frame = new JFrame();
		frame.setLayout(new BorderLayout());
		
		WorldCanvas canvas = new WorldCanvas();
		World world = new World();
		canvas.setModel(world);
		Controller controller = new Controller(world,canvas);
		
		frame.getContentPane().add(canvas,BorderLayout.CENTER);
		frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
		frame.setSize(600, 600);
		frame.setVisible(true);

		Timer timer = new Timer();
		timer.schedule(new GrowFoodTask(controller), 0, 1000);
	}
}
